// DMS Donations Management System v1.0                 
// created by:  Isaac Sabas                   
//				Nikko Reyes
//				Miko Tiamwatt          
//                                                      
// De La Salle Philippines                              
// All Rights Reserved DLSP Copyright 2009        

function open_primary_window(call_purpose, client_id, ticket_id) {
	if (call_purpose == '2') {		
		open_client_window(client_id);		
	}
	else if (call_purpose == '1') {
		open_donation_ticket(client_id, ticket_id);		
	}	
}

function hide_client_item( id ) {		
	parent.dashboard_client_content.hide_item(id);
	YAHOO.dms.done_confirmation_dialog[id].close_dialog();
}


//---------------------------
// MODAL DIALOG CONFIRMATION
//---------------------------

//
function edit_client_name(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_name_dialog[id]) {
			var window_name = "client_edit_name_dialog_" + id;	// window id
			var window_close = "client_edit_name_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_name_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"250px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.client_edit_name_dialog[id].close_dialog = function () {
																YAHOO.dms.client_edit_name_dialog[id].hide();
																YAHOO.dms.client_edit_name_dialog[id].destroy();
																YAHOO.dms.client_edit_name_dialog[id] = null;
															}	
				YAHOO.dms.client_edit_name_dialog[id].setHeader("Edit Client Name");
				YAHOO.dms.client_edit_name_dialog[id].setBody("<iframe id='client_edit_name" + id + "' src='dashboard/windows/ClientEditNameWindow.php?client_id= " + id + "' width=290 height=200 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_name_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.client_edit_name_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_name_dialog[id].focus, YAHOO.dms.client_edit_name_dialog[id], true);  
		}	
}


function edit_client_gender(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_gender_dialog[id]) {
			var window_name = "client_edit_gender_dialog_" + id;	// window id
			var window_close = "client_edit_gender_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_gender_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"250px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.client_edit_gender_dialog[id].close_dialog = function () {
																YAHOO.dms.client_edit_gender_dialog[id].hide();
																YAHOO.dms.client_edit_gender_dialog[id].destroy();
																YAHOO.dms.client_edit_gender_dialog[id] = null;
															}	
				YAHOO.dms.client_edit_gender_dialog[id].setHeader("Edit Client Gender");
				YAHOO.dms.client_edit_gender_dialog[id].setBody("<iframe id='client_edit_gender" + id + "' src='dashboard/windows/ClientEditGenderWindow.php?client_id= " + id + "' width=290 height=200 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_gender_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.client_edit_gender_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_gender_dialog[id].focus, YAHOO.dms.client_edit_gender_dialog[id], true);  
		}	
}

function edit_client_school(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_school_dialog[id]) {
			var window_name = "client_edit_school_dialog_" + id;	// window id
			var window_close = "client_edit_school_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_school_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"250px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.client_edit_school_dialog[id].close_dialog = function () {
																YAHOO.dms.client_edit_school_dialog[id].hide();
																YAHOO.dms.client_edit_school_dialog[id].destroy();
																YAHOO.dms.client_edit_school_dialog[id] = null;
															}	
				YAHOO.dms.client_edit_school_dialog[id].setHeader("Edit Client School");
				YAHOO.dms.client_edit_school_dialog[id].setBody("<iframe id='client_edit_school_" + id + "' src='dashboard/windows/ClientEditSchoolWindow.php?client_id= " + id + "' width=290 height=200 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_school_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.client_edit_school_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_school_dialog[id].focus, YAHOO.dms.client_edit_school_dialog[id], true);  
		}	
}

function edit_client_course(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_course_dialog[id]) {
			var window_name = "client_edit_course_dialog_" + id;	// window id
			var window_close = "client_edit_course_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_course_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"250px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.client_edit_course_dialog[id].close_dialog = function () {
																YAHOO.dms.client_edit_course_dialog[id].hide();
																YAHOO.dms.client_edit_course_dialog[id].destroy();
																YAHOO.dms.client_edit_course_dialog[id] = null;
															}	
				YAHOO.dms.client_edit_course_dialog[id].setHeader("Edit Client Course");
				YAHOO.dms.client_edit_course_dialog[id].setBody("<iframe id='client_edit_course_" + id + "' src='dashboard/windows/ClientEditCourseWindow.php?client_id= " + id + "' width=290 height=200 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_course_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.client_edit_course_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_course_dialog[id].focus, YAHOO.dms.client_edit_course_dialog[id], true);  
		}	
}

function edit_client_graduate(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_graduate_dialog[id]) {
			var window_name = "client_edit_graduate_dialog_" + id;	// window id
			var window_close = "client_edit_graduate_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_graduate_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"250px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.client_edit_graduate_dialog[id].close_dialog = function () {
																YAHOO.dms.client_edit_graduate_dialog[id].hide();
																YAHOO.dms.client_edit_graduate_dialog[id].destroy();
																YAHOO.dms.client_edit_graduate_dialog[id] = null;
															}	
				YAHOO.dms.client_edit_graduate_dialog[id].setHeader("Edit Client Graduate");
				YAHOO.dms.client_edit_graduate_dialog[id].setBody("<iframe id='client_edit_graduate_" + id + "' src='dashboard/windows/ClientEditGraduateWindow.php?client_id= " + id + "' width=290 height=200 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_graduate_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.client_edit_graduate_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_graduate_dialog[id].focus, YAHOO.dms.client_edit_graduate_dialog[id], true);  
		}	
}

function edit_client_company(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_company_dialog[id]) {
			var window_name = "client_edit_company_dialog_" + id;	// window id
			var window_close = "client_edit_company_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_company_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"250px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.client_edit_company_dialog[id].close_dialog = function () {
																YAHOO.dms.client_edit_company_dialog[id].hide();
																YAHOO.dms.client_edit_company_dialog[id].destroy();
																YAHOO.dms.client_edit_company_dialog[id] = null;
															}	
				YAHOO.dms.client_edit_company_dialog[id].setHeader("Edit Client Company");
				YAHOO.dms.client_edit_company_dialog[id].setBody("<iframe id='client_edit_company_" + id + "' src='dashboard/windows/ClientEditCompanyWindow.php?client_id= " + id + "' width=290 height=200 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_company_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.client_edit_company_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_company_dialog[id].focus, YAHOO.dms.client_edit_company_dialog[id], true);  
		}	
}

function edit_client_position(id) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.client_edit_position_dialog[id]) {
			var window_name = "client_edit_position_dialog_" + id;	// window id
			var window_close = "client_edit_position_dialog_" + id;// window close button id	
	
			// build the modal wind	w (refer to YUI documentation for more information
				YAHOO.dms.client_edit_position_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"250px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.client_edit_position_dialog[id].close_dialog = function () {
																YAHOO.dms.client_edit_position_dialog[id].hide();
																YAHOO.dms.client_edit_position_dialog[id].destroy();
																YAHOO.dms.client_edit_position_dialog[id] = null;
															}	
				YAHOO.dms.client_edit_position_dialog[id].setHeader("Edit Client Position");
				YAHOO.dms.client_edit_position_dialog[id].setBody("<iframe id='client_edit_position_" + id + "' src='dashboard/windows/ClientEditPositionWindow.php?client_id= " + id + "' width=290 height=200 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <input type='button' value='Close' onclick='YAHOO.dms.client_edit_position_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.client_edit_position_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.client_edit_position_dialog[id].focus, YAHOO.dms.client_edit_position_dialog[id], true);  
		}	
}


// opens the reschedule confirmation upon clicking done in the reschedule window
function show_reschedule_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.reschedule_dialog[id]) {
			var window_name = "reschedule_dialog_" + id; 	// window id
			var window_close = "reschedule_dialog_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.reschedule_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.reschedule_dialog[id].close_dialog = function () {
																YAHOO.dms.reschedule_dialog[id].hide();
																YAHOO.dms.reschedule_dialog[id].destroy();
																YAHOO.dms.reschedule_dialog[id] = null;
															}	
				YAHOO.dms.reschedule_dialog[id].setHeader("Reschedule Pickup Date");
				// set the body content
					YAHOO.dms.reschedule_dialog[id].setBody("Are you sure you want to reschedule donation pickup date?<br /><input type='button' value='Yes' onclick='' /><input type='button' value='No' onclick='YAHOO.dms.reschedule_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.reschedule_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.reschedule_dialog[id].focus, YAHOO.dms.reschedule_dialog[id], true);  
		}	
}



function show_close_donation_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.close_donation_dialog[id]) {
			var window_name = "close_donation_dialog_" + id;	// window id
			var window_close = "close_donation_dialog_" + id;	// window close button id
			
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.close_donation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.close_donation_dialog[id].close_dialog = function () {
																YAHOO.dms.close_donation_dialog[id].hide();
																YAHOO.dms.close_donation_dialog[id].destroy();
																YAHOO.dms.close_donation_dialog[id] = null;
															}	
				YAHOO.dms.close_donation_dialog[id].setHeader("Complete Close Donation");
				YAHOO.dms.close_donation_dialog[id].setBody("Are you sure you want to close this ticket for donation?<br /><input type='button' value='Yes' onclick='' /><input type='button' value='No' onclick='YAHOO.dms.close_donation_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.close_donation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.close_donation_dialog[id].focus, YAHOO.dms.close_donation_dialog[id], true);  
		}	
}

function show_cancel_donation_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window	
		if (!YAHOO.dms.cancel_donation_dialog[id]) {
			var window_name = "cancel_donation_dialog_" + id;	// window id
			var window_close = "cancel_donation_dialog_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.cancel_donation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.cancel_donation_dialog[id].close_dialog = function () {
																YAHOO.dms.cancel_donation_dialog[id].hide();
																YAHOO.dms.cancel_donation_dialog[id].destroy();
																YAHOO.dms.cancel_donation_dialog[id] = null;
															}	
				YAHOO.dms.cancel_donation_dialog[id].setHeader("Cancel Donation");
				YAHOO.dms.cancel_donation_dialog[id].setBody("Are you sure you want to mark this ticket for closing?<br /><input type='button' value='Yes' onclick='' /><input type='button' value='No' onclick='YAHOO.dms.cancel_donation_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.cancel_donation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.cancel_donation_dialog[id].focus, YAHOO.dms.cancel_donation_dialog[id], true);  
		}	
}

function show_add_referral_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window	
		if (!YAHOO.dms.add_referral_dialog[id]) {
			var window_name = "add_referral_dialog_" + id;	// window id
			var window_close = "add_referral_dialog_" + id;	// window close button id
		
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.add_referral_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.add_referral_dialog[id].close_dialog = function () {
																YAHOO.dms.add_referral_dialog[id].hide();
																YAHOO.dms.add_referral_dialog[id].destroy();
																YAHOO.dms.add_referral_dialog[id] = null;
															}	
				YAHOO.dms.add_referral_dialog[id].setHeader("Add Referral");
				YAHOO.dms.add_referral_dialog[id].setBody("Are you sure you want to add this referral client?<br /><input type='button' value='Yes' onclick='' /><input type='button' value='No' onclick='YAHOO.dms.add_referral_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.add_referral_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.add_referral_dialog[id].focus, YAHOO.dms.add_referral_dialog[id], true);  
		}	
}

function show_send_greeting_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.greeting_confirmation_dialog[id]) {
			var window_name = "greeting_confirmation_dialog_" + id;	// window id
			var window_close = "greeting_confirmation_dialog_" + id;// window close button id	
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.greeting_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.greeting_confirmation_dialog[id].close_dialog = function () {
																YAHOO.dms.greeting_confirmation_dialog[id].hide();
																YAHOO.dms.greeting_confirmation_dialog[id].destroy();
																YAHOO.dms.greeting_confirmation_dialog[id] = null;
															}	
				YAHOO.dms.greeting_confirmation_dialog[id].setHeader("Send Email Birthday Greeting");
				YAHOO.dms.greeting_confirmation_dialog[id].setBody("Are you sure you want to send email birthday greeting?<br /><input type='button' value='Yes' onclick='' /><input type='button' value='No' onclick='YAHOO.dms.greeting_confirmation_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.greeting_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.greeting_confirmation_dialog[id].focus, YAHOO.dms.greeting_confirmation_dialog[id], true);  
		}	
}

function show_received_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.received_confirmation_dialog[id]) {
			var window_name = "received_confirmation_dialog_" + id;	// window id
			var window_close = "received_confirmation_dialog_" + id;// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.received_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.received_confirmation_dialog[id].close_dialog = function () {
																YAHOO.dms.received_confirmation_dialog[id].hide();
																YAHOO.dms.received_confirmation_dialog[id].destroy();
																YAHOO.dms.received_confirmation_dialog[id] = null;
															}	
				YAHOO.dms.received_confirmation_dialog[id].setHeader("Collection Received Confirmation");
				YAHOO.dms.received_confirmation_dialog[id].setBody("Are you sure you have received the collection?<br /><input type='button' value='Yes' onclick='' /><input type='button' value='No' onclick='YAHOO.dms.received_confirmation_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.received_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.received_confirmation_dialog[id].focus, YAHOO.dms.received_confirmation_dialog[id], true);  
		}	
}

function show_done_confirmation( id ) {
	// check first if the instance of that window exist, if not procede with building the modal confirmation window
		if (!YAHOO.dms.done_confirmation_dialog[id]) {
			var window_name = "done_confirmation_dialog_" + id;	// window id
			var window_close = "done_confirmation_dialog_" + id;// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.done_confirmation_dialog[id] = new YAHOO.widget.Panel(window_name, { 
					width:"240px", 
					height:"100px", 
					fixedcenter:true, 
					close:false, 
					draggable:false, 
					zindex:4,
					modal:true,
					visible:true,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.done_confirmation_dialog[id].close_dialog = function () {
																YAHOO.dms.done_confirmation_dialog[id].hide();
																YAHOO.dms.done_confirmation_dialog[id].destroy();
																YAHOO.dms.done_confirmation_dialog[id] = null;
															}	
				YAHOO.dms.done_confirmation_dialog[id].setHeader("Call Complete Confirmation");
				YAHOO.dms.done_confirmation_dialog[id].setBody("Are you sure you are done with the call?<br /><input type='button' value='Yes' onclick='hide_client_item(" + id + ")' /><input type='button' value='No' onclick='YAHOO.dms.done_confirmation_dialog[" + id + "].close_dialog()' />");
				YAHOO.dms.done_confirmation_dialog[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.done_confirmation_dialog[id].focus, YAHOO.dms.done_confirmation_dialog[id], true);  
		}	
}

//-------------
// OPEN WINDOW 
//-------------

// NOTE: //
// for the sizes of the windows, it's ok to play around with the size, as long as you ADJUST THE SIZE OF THE IFRAME TOO and that everything is seen in the window

function open_donation_ticket(id, ticket_id) {
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_donationticket_windows[id]) {		
			var window_name = "donationticket_window_" + id;		// window id
			var window_close = "donationticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_donationticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"320px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 			
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}});	
			
				YAHOO.dms.dashboard_donationticket_windows[id].close_window = function () {
																YAHOO.dms.dashboard_donationticket_windows[id].hide();
																YAHOO.dms.dashboard_donationticket_windows[id].destroy();
																YAHOO.dms.dashboard_donationticket_windows[id] = null;
															}
				YAHOO.dms.dashboard_donationticket_windows[id].setHeader("Ticket Review Window: ");
				
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_donationticket_windows[id].setBody("<iframe id='ticketdonation_window_" + id + "' src='dashboard/windows/dashboardTicketWindow.php?ticket_id= " + ticket_id + "' width=280 height=205 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' value='New Ticket' onClick='open_newticket_window(1)' /><input type='button' value='Resched Pickup' onClick='open_reschedule_window( " + ticket_id + ", " + id + " )' /><input type='button' value='Profile' onClick='open_profile_window(" + id + ")' /><input type='button' value='Cancel Donation' onclick='show_cancel_donation_confirmation(" + id + ")' /><input type='button' onclick='YAHOO.dms.dashboard_donationticket_windows[" + id + "].close_window()' value='Close'/>");
				//YAHOO.dms.dashboard_donationticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_donationticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_donationticket_windows[id].focus, YAHOO.dms.dashboard_donationticket_windows[id], true);  
		}
}

function open_client_window( id ) {		
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_client_windows[id]) {
			var window_name = "client_window_" + id;		// window id
			var window_close = "client_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_client_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"600px", 
					height:"500px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.dashboard_client_windows[id].close_window = function () {
																YAHOO.dms.dashboard_client_windows[id].hide();
																YAHOO.dms.dashboard_client_windows[id].destroy();
																YAHOO.dms.dashboard_client_windows[id] = null;
															}			
				YAHOO.dms.dashboard_client_windows[id].setHeader("Client Window: ");
				
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_client_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_client_windows[id].setBody("<iframe id='client_window_" + id + "' src='dashboard/windows/dashboardClientWindow.php?client_id= " + id + "' width=590 height=400 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_client_windows[" + id + "].close_window()' value='Close'/><input type='button' value='New Ticket' onclick='open_newticket_window(1)' /><input type='button' value='Add Referral' onclick='open_newreferral_window(1)' />");
				//YAHOO.dms.dashboard_client_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_client_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_client_windows[id].focus, YAHOO.dms.dashboard_client_windows[id], true);  
		}			
}

function open_profile_window( id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_clientprofile_windows[id]) {		
			var window_name = "clientprofile_window_" + id;			// window id
			var window_close = "clientprofile_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_clientprofile_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"500px", 
					height:"400px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}});	
			
				YAHOO.dms.dashboard_clientprofile_windows[id].close_window = function () {
																YAHOO.dms.dashboard_clientprofile_windows[id].hide();
																YAHOO.dms.dashboard_clientprofile_windows[id].destroy();
																YAHOO.dms.dashboard_clientprofile_windows[id] = null;
															}			
				YAHOO.dms.dashboard_clientprofile_windows[id].setHeader("Client Profile Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_client_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_clientprofile_windows[id].setBody("<iframe id='clientprofile_window_" + id + "' src='dashboard/windows/dashboardClientWindow.php?client_id= " + id + "' width=280 height=400 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_clientprofile_windows[" + id + "].close_window()' value='Close'/><input type='button' value='Add Referral' onclick='' />");
				//YAHOO.dms.dashboard_clientprofile_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_clientprofile_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_clientprofile_windows[id].focus, YAHOO.dms.dashboard_clientprofile_windows[id], true);  
		}
}
	
function open_notification_window( id, window_id ) {
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_notification_windows[id]) {			
			var window_name = "notification_window_" + id;			// window id
			var window_close = "notification_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_notification_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"400px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}});	
			
				YAHOO.dms.dashboard_notification_windows[id].close_window = function () {
																YAHOO.dms.dashboard_notification_windows[id].hide();
																YAHOO.dms.dashboard_notification_windows[id].destroy();
																YAHOO.dms.dashboard_notification_windows[id] = null;
															}
				YAHOO.dms.dashboard_notification_windows[id].setHeader("Notification Window: " + window_id);
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_notification_window.php with GET notification_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_notification_windows[id].setBody("<iframe id='notification_window_" + id + "' src='dashboard/windows/dashboardNotificationWindow.php?notification_window_id= " + id + "' width=280 height=295 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_notification_windows[" + id + "].close_window()' value='Close'/>");
				//YAHOO.dms.dashboard_notification_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_notification_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_notification_windows[id].focus, YAHOO.dms.dashboard_notification_windows[id], true);  
		}
}

function open_ticket_window( id, client_id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_ticket_windows[id]) {		
			var window_name = "ticket_window_" + id;		// window id
			var window_close = "ticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_ticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"300px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );	
			
				YAHOO.dms.dashboard_ticket_windows[id].close_window = function () {
																YAHOO.dms.dashboard_ticket_windows[id].hide();
																YAHOO.dms.dashboard_ticket_windows[id].destroy();
																YAHOO.dms.dashboard_ticket_windows[id] = null;
															}
				YAHOO.dms.dashboard_ticket_windows[id].setHeader("Ticket Review Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_ticket_windows[id].setBody("<iframe id='ticket_window_" + id + "' src='dashboard/windows/dashboardTicketWindow.php?ticket_id= " + client_id + "' width=280 height=205 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_ticket_windows[" + id + "].close_window()' value='Close'/>");
				//YAHOO.dms.dashboard_ticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_ticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_ticket_windows[id].focus, YAHOO.dms.dashboard_ticket_windows[id], true);  
		}
}

function open_newticket_window( id, client_id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_newticket_windows[id]) {		
			var window_name = "newticket_window_" + id;			// window id
			var window_close = "newticket_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_newticket_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"300px", 
					height:"500px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}});	
			
				YAHOO.dms.dashboard_newticket_windows[id].close_window = function () {
																YAHOO.dms.dashboard_newticket_windows[id].hide();
																YAHOO.dms.dashboard_newticket_windows[id].destroy();
																YAHOO.dms.dashboard_newticket_windows[id] = null;
															}
				YAHOO.dms.dashboard_newticket_windows[id].setHeader("New Ticket Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_ticket_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_newticket_windows[id].setBody("<iframe id='newticket_window_" + id + "' src='dashboard/windows/dashboardTicketWindow.php' width=280 height=415 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_newticket_windows[" + id + "].close_window()' value='Cancel'/><input type='button' value='Done' onClick='' />");
				//YAHOO.dms.dashboard_newticket_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_newticket_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_newticket_windows[id].focus, YAHOO.dms.dashboard_newticket_windows[id], true);  
		}
}

function open_newreferral_window( id, client_id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_newreferral_windows[id]) {		
			var window_name = "newreferral_window_" + id;			// window id
			var window_close = "newreferral_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_newreferral_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"250px", 
					height:"220px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}});	
			
				YAHOO.dms.dashboard_newreferral_windows[id].close_window = function () {
																YAHOO.dms.dashboard_newreferral_windows[id].hide();
																YAHOO.dms.dashboard_newreferral_windows[id].destroy();
																YAHOO.dms.dashboard_newreferral_windows[id] = null;
															}
				YAHOO.dms.dashboard_newreferral_windows[id].setHeader("New Referral Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_referral_window.php
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_newreferral_windows[id].setBody("<iframe id='newreferral_window_" + id + "' src='dashboard/windows/dashboardReferralWindow.php' width=230 height=120  marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_newreferral_windows[" + id + "].close_window()' value='Cancel'/><input type='button' value='Done' onClick='show_add_referral_confirmation(" + id + ")'>");
				//YAHOO.dms.dashboard_newreferral_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_newreferral_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_newreferral_windows[id].focus, YAHOO.dms.dashboard_newreferral_windows[id], true);  
		}
}

function open_reschedule_window( id, client_id ) {	
	// check first if the instance of that window exist, if not procede with building the window
		if (!YAHOO.dms.dashboard_reschedule_windows[id]) {		
			var window_name = "reschedule_window_" + id;		// window id
			var window_close = "reschedule_window_close_" + id;	// window close button id
	
			// build the modal window (refer to YUI documentation for more information
				YAHOO.dms.dashboard_reschedule_windows[id] = new YAHOO.widget.Panel(window_name, { 
					width:"250px", 
					height:"120px", 
					visible:true, 
					constraintoviewport:true, 
					draggable:true, 
					fixedcenter:true, 
					close:false, 
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}});	
			
				YAHOO.dms.dashboard_reschedule_windows[id].close_window = function () {
																YAHOO.dms.dashboard_reschedule_windows[id].hide();
																YAHOO.dms.dashboard_reschedule_windows[id].destroy();
																YAHOO.dms.dashboard_reschedule_windows[id] = null;
															}
				YAHOO.dms.dashboard_reschedule_windows[id].setHeader("New Referral Window: ");
				// set body content
				// contents of this window is an iframe with a UNIQUE ID, and a src .php code: dashboard_reschedule_window.php with GET client_id parameter
				// the contents also contain the close button which calls the close method of that specific instance of the window
					YAHOO.dms.dashboard_reschedule_windows[id].setBody("<iframe id='reschedule_window_" + id + "' src='dashboard/windows/dashboardRescheduleWindow.php?client_id=" + id + "' width=230 height=50  marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=auto style='overflow-x: hidden;'></iframe> <br><input type='button' onclick='YAHOO.dms.dashboard_reschedule_windows[" + id + "].close_window()' value='Cancel'/><input type='button' value='Done' onClick='show_reschedule_confirmation(" + id + ")'>");
				//YAHOO.dms.dashboard_newreferral_windows[id].setFooter("-------");					
	
				YAHOO.dms.dashboard_reschedule_windows[id].render("dashboard_clients_panel");
				YAHOO.util.Event.addListener(window_name, window_close, YAHOO.dms.dashboard_reschedule_windows[id].focus, YAHOO.dms.dashboard_reschedule_windows[id], true);  
		}
}
